using UnityEngine;
using System.Collections;

/// \class  gkSpawningScaleModifier
/// \brief  Select a spawning scale
[AddComponentMenu("GK/Engine/Game/Spawn/gkSpawningScaleModifier")]
public class gkSpawningScaleModifier : gkSpawningModifier 
{
	/// The minimum scale
	public float ScaleMin = 1;
	
	/// The maximum scale
	public float ScaleMax = 1;
	
	/// \brief  Event called at the and of the actor spawn
	public override void ModifySpawnedActor(GameObject a_rSpawnedActor, int a_iNumActorsInCurrentBatch, int a_iNbActorsInCurrentBatch)
	{
		RandomScale(a_rSpawnedActor);
	}
	
	/// \brief  Random scale of a spawned actor
	void RandomScale(GameObject a_rSpawnedActor)
	{
		float fRandomScale;
	
		fRandomScale = Random.Range(ScaleMin, ScaleMax);
	
		a_rSpawnedActor.transform.localScale = new Vector3(fRandomScale, fRandomScale, fRandomScale);
	}
}
